<?php
namespace app\admin\controller;

class Lunbo extends Admin {
	public function __construct() {
		parent::__construct();
		$this->model = "Lunbo";
		$this->assign("model", $this->model);
	}

	public function image() {
		$id = input('param.id');
		$info = model($this->model)->get_data(['item_id' => $id]);
		$this->assign('info', $info);
		return $this->fetch();
	}

	protected function get_where_map() {
		// $whereData = input("param.whereData/s");
		$keywords = input('param.keywords');
		// $whereData = urldecode($whereData);
		$whereDatas = [];
		// if ($whereData) {
		//     $whereData = explode('&', $whereData);
		//     foreach ($whereData as $v) {
		//         $r = explode('=', $v);
		//         if ($r[0] == 'keywords') {
		//             $whereDatas = [];
		//             $whereDatas['id|title|descrip'] = ['like', '%'.$r[1].'%'];
		//             break;
		//         }else{
		//             $whereDatas[$r[0]] = $r[1];
		//         }
		//     }
		// }
		// if ($this->uinfo['roleid'] != 1) {
		//     $whereDatas['userid'] = $this->uinfo['userid'];
		// }
		if ($keywords) {
			$whereDatas['id|title|descrip'] = ['like', "%$keywords%"];
		}
		return $whereDatas;
	}
}